<?php
namespace app\model;
use DateTimeInterface;
use support\Model;

class BaseModel extends Model
{
    //模型的连接名称
    protected $connection = 'mysql';

    //时间戳写入
    protected $dateFormat = 'U';

    //创建时间
    const CREATED_AT = 'create_time';

    //更新时间
    const UPDATED_AT = 'update_time';

    protected function serializeDate(DateTimeInterface $date): string
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }
}